package com.alks.function.mapper.procurement;


import com.alks.entity.data.entity.PcPackOther;
import com.alks.function.data.dto.procurement.PcPackOtherDto;
import com.alks.function.data.request.procurement.NotOrderMaterialRequest;
import com.alks.function.data.request.procurement.PcPackDetailRequest;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@Mapper
public interface PackagOtherOrderingOperationMapper {

    /*待订购明细-查询*/
    List<PcPackOtherDto> getNotOrderMaterialList(@Param("companyId") String companyId, @Param("request") NotOrderMaterialRequest request);

    /*已订购明细查询*/
    List<PcPackOtherDto> getOrderedDetailsList(@Param("companyId") String companyId, @Param("request") NotOrderMaterialRequest request);

    /*批量修改未订购*/
    int updateBatchNotOrderDetails(@Param("request") List<PcPackDetailRequest> request);

    /*批量修改已订购*/
    int updateBatchOrderedDetails(@Param("request") List<PcPackDetailRequest> request);

    /*修改需求日期/单价*/
    int updateReqDateAndUPrice(@Param("companyId") String companyId, @Param("request") PcPackDetailRequest request, @Param("newPrice") BigDecimal newPrice, @Param("newPurDate") Date newPurDate);

    /*订购单取消*/
    int updateBatchOrderedBeNull(String slipNo);

    /*批量添加未订购材料*/
    int addBatchOrderedMaterial(@Param("request") List<PcPackOther> request);

    /*生成订购单*/
    int makePurchaseOrder(List<PcPackDetailRequest> request);

    /*查某个订购单号的不同物料的数量*/
    List<PcPackOtherDto> getOrderedDetailsGroupList(@Param("companyId") String companyId, @Param("request") NotOrderMaterialRequest r);

    /*查该订单号所有规格*/
    List<PcPackOtherDto> getMtlSpecAndSize(@Param("companyId") String companyId, @Param("purNo") String purNo);

    List<PcPackOtherDto> getMtlSpecAndSize2(@Param("companyId") String companyId, @Param("purNo") String purNo);

    /*每个lotNo对应相应的总purQTY*/
    List<PcPackOtherDto> getPurQtyByLotNo(@Param("companyId") String companyId,@Param("purNo") String purNo);

    List<PcPackOtherDto> getPurQtyByLotNo2(@Param("companyId") String companyId,@Param("purNo") String purNo);

    /*lotNo对应不同的MTLSPec的不同purQTY*/
    List<PcPackOtherDto> getPurQtyByMtlSpec(@Param("companyId") String companyId,@Param("purNo") String purNo);

    List<PcPackOtherDto> getPurQtyByMtlSpec2(@Param("companyId") String companyId,@Param("purNo") String purNo);

    /*不同mtlNo的所有数量*/
    List<PcPackOtherDto> getAllPurQtyByMtlSpec(@Param("companyId") String companyId, @Param("request") NotOrderMaterialRequest r);

    /*待订购明细:删除*/
    int deleteNotOrderMaterial(@Param("list") List<Integer> ids);

    /*统计LotNo() + MtlName() + getMtlUnit() + Size1() + Size2()相同的数据的订购数量(按照指令升序，物料编码升序)*/
    List<PcPackOtherDto> getOrdersByCondition(String companyId, String purNo);

    /*分组查询该指令的MtlName() + getMtlUnit() + Size1() + Size2()相同的数据(按照物料编码升序)*/
    List<PcPackOtherDto> getOrdersByCondition2(String companyId, String purNo);

    /*查该订单号所有规格*/
    List<String> getMtlSpec(String companyId, String purNo);
}


